﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ImportExcelView.aspx.cs" Inherits="Buffalo.Web.Areas.Tourism.Views.Pages.ImportExcelView" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
    protected void UploadClick(object sender, DirectEventArgs e)
    {
        string tpl = "Uploaded file: {0}<br/>Size: {1} bytes";
        
        if (this.FileUploadField1.HasFile)
        {
           X.Msg.Show(new MessageBoxConfig
            {
                Buttons = MessageBox.Button.OK,
                Icon = MessageBox.Icon.INFO,
                Title = "Success",
                Message = string.Format(tpl, this.FileUploadField1.PostedFile.FileName, this.FileUploadField1.PostedFile.ContentLength)
            });
        }
        else
        {
           X.Msg.Show(new MessageBoxConfig
            {
                Buttons = MessageBox.Button.OK,
                Icon = MessageBox.Icon.ERROR,
                Title = "Fail",
                Message = "No file uploaded"
            });
        }
    }
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>FormPanel - Ext.NET Examples</title>

</head>
<body>
    <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        
            
                <ext:TextField ID="PhotoName" runat="server" FieldLabel="Name webform1 " />
                <ext:FileUploadField 
                    ID="FileUploadField1" 
                    runat="server" 
                    EmptyText="Select an image"
                    FieldLabel="Photo"
                    ButtonText ="Select file..."
                    Icon="ImageAdd"
                    />
                <ext:Button ID="SaveButton" runat="server" Text="Save">
                    <DirectEvents>
                        <Click 
                            OnEvent="UploadClick"
                            Failure="Ext.Msg.show({ 
                                title   : 'Error', 
                                msg     : 'Error during uploading', 
                                minWidth: 200, 
                                modal   : true, 
                                icon    : Ext.Msg.ERROR, 
                                buttons : Ext.Msg.OK 
                            });">
                        </Click>
                    </DirectEvents>
                </ext:Button>
    </form>
</body>
</html>